<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js">&lt;?php
<span id='global-property-'>/**
</span> * Cube PHP Framework
 * 
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the &quot;License&quot;); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * @author Dillen / Steffen
 */

namespace Library\Mvc\Event;

<span id='Library-Mvc-EventManager'>/**
</span> * The Eventmanager
 * 
 * @class Library.Mvc.EventManager
 */
class Manager
{
<span id='Library-Mvc-EventManager-property-Array'>	/**
</span>	 * All events
	 * 
	 * @property Array _events
	 * @var array
	 */
	private $_events = array();
	
<span id='Library-Mvc-EventManager-property-Array'>	/**
</span>	 * Application configuration
	 * 
	 * @property Array _config
	 * @var array
	 */
	private $_config;
	
<span id='Library-Mvc-EventManager-method-__construct'>	/**
</span>	 * Constructor
	 * 
	 * @param Array config
	 * @method __construct
	 */
	public function __construct($config)
	{
		$this-&gt;_config = $config;
	}
	
<span id='Library-Mvc-EventManager-method-__get'>	/**
</span>	 * Get event by name
	 * 
	 * @param String key
	 * @method __get
	 */
	public function __get($key)
	{
		if (!isset($this-&gt;_events[$key]))
		{
			throw new \Exception('The event ' . $key . ' is not created yet.');
		}
		
		return $this-&gt;_events[$key];
	}
	
<span id='Library-Mvc-EventManager-method-create'>	/**
</span>	 * Create new event
	 * 
	 * @param String name
	 * @method create
	 */
	public function create($name)
	{
		$class = '\\' . $this-&gt;_config['application']['module'] . '\\Events\\' . $name;
		
		$this-&gt;_events[$name] = new $class;
	}
}</pre>
</body>
</html>
